﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
namespace UI.ModSalary
{
    public partial class DefAccountSetItemList : System.Web.UI.Page
    {
        DefDicBiz defineDictionary = new DefDicBiz();
        SetsItemBiz slDefineBiz = new SetsItemBiz();
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                defineDictionary.InitDropDownList("Wage_Sets", ddlAccountSet, "1");
                btnAdd.Attributes.Add("onclick", "javascript:ShowLink('SetsItemAdd.aspx?Aset=1',850,600);");
                btnConfigTax.Attributes.Add("onclick", "javascript:ShowLink('DefTax.aspx',850,600);");
                BindData("1");
            }
        }
        private void BindData(string accountSetID)
        {
            DataTable dt = slDefineBiz.GetItemList(accountSetID);
            gvList.DataSource = dt;
            gvList.DataBind();

        }
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {

            if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Cells[0].Visible = false;
            }

        }

        protected void ddlAccountSet_SelectedIndexChanged(object sender, EventArgs e)
        {
            string accountSetID = ddlAccountSet.SelectedValue;
            btnAdd.Attributes.Clear();
            btnAdd.Attributes.Add("onclick", "javascript:ShowLink(SetsItemAdd.aspx?Aset=" + accountSetID + "',600,480);");
           
            BindData(accountSetID);
        }
    }
}